package NewTablePanels;

import javax.swing.*;

public class NewAirportTable extends JPanel {

	private JPanel leftPart;
	private JPanel rightPart;
	
	private JLabel nameLabel;
	private JLabel airportIDLabel;
	private JLabel cityLabel;
	private JLabel nationLabel;
	private JLabel terminalsLabel;
	
	private JTextField nameField;
	private JTextField airportIDField;
	private JTextField cityField;
	private JTextField nationField;
	private JTextField terminalsField;
	
	public NewAirportTable()
	{
		nameLabel = new JLabel("Name: ");
		airportIDLabel = new JLabel("Airport-ID: ");
		cityLabel = new JLabel("City: ");
		nationLabel = new JLabel("Nation: ");
		terminalsLabel = new JLabel("Terminals: ");
		
		nameField = new JTextField(20);
		airportIDField = new JTextField(20);
		cityField = new JTextField(20);
		nationField = new JTextField(20);
		terminalsField = new JTextField(20);
		
		leftPart = new JPanel();
		rightPart = new JPanel();
		
		leftPart.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
		rightPart.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
		
		fillLeftPart();
		fillRightPart();
		
		this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
		this.add(leftPart);
		this.add(rightPart);
		this.setVisible(false);
	}
	
	private void fillLeftPart()
	{
		leftPart.add(nameLabel);
		leftPart.add(airportIDLabel);
		leftPart.add(cityLabel);
		leftPart.add(nationLabel);
		leftPart.add(terminalsLabel);
	}
	
	private void fillRightPart()
	{
		rightPart.add(nameField);
		rightPart.add(airportIDField);
		rightPart.add(cityField);
		rightPart.add(nationField);
		rightPart.add(terminalsField);
	}
}
